<?xml version="1.0" encoding="utf-8"?>
<taskrunner name="uninstall" version="1.3" date="2013-06-20" maxthreads="1">

	<!-- Script för avinstallation 
  
  Dependencies:
    Global Properties
      ¤{INSTALL.TYPE} must be set to either UNINSTALL or REINSTALL
  
  Change Log:
      2013-06-20 : teriks28 : OGB project : eSWDL files will not be delivered toghter with Vida any more.
        Added input parameter "RestoreEswdl" to be past to task "delete.eswdl"
  -->
  
	<includes>
		<file name="vida.install.settings.xml" />
	</includes>

  <parameters>
    <parameter name="RestoreEswdl" value="#INPUT"/>
  </parameters>

	<tasks>
    
    <task name="Write.restore.eswdl" typename="@WriteInformation">
      <parameters>
        <parameter name="message" value="vida.douninstall.xml RestoreEswdl: ${RestoreEswdl}"/>
      </parameters>
    </task>
    
    <task name="set.install.type">
      <description>
        Sets the global property install.type to UNINSTALL.
      </description>
      <dependencies list="Write.restore.eswdl"/>
      <subtasks filename="vida.setinstalltype.xml">
        <parameters>
          <parameter name="install.type" value="UNINSTALL"/>
        </parameters>
      </subtasks>
    </task>

    <task name="remove.readonly.attribute" critical="false" typename="@CommandLine">
      <description>
        removes the attribute read-only on all files in ${target.db.update.dir}
      </description>
      <dependencies list="set.install.type"/>
      <parameters>
        <parameter name="arguments" value="attrib -R /S /D"/>
        <parameter name="workingdirectory" value="${target.root}"/>
        <parameter name="useCmdExe" value="true"/>
      </parameters>
    </task>
    
    <task name="delete.eswdl" condition="${RestoreEswdl}=false">
      <dependencies list="remove.readonly.attribute"/>
      <subtasks filename="eswdl.uninstall.xml"/>
    </task>
    
    <task name="remove">
      <dependencies list="delete.eswdl,remove.readonly.attribute"/>
      <subtasks filename="vida.remove.files.xml"/>
    </task>

    <task name="delete.root.files" typename="@DeleteFiles">
      <dependencies list="remove,remove.readonly.attribute"/>
      <parameters>
        <parameter name="directory" value="${target.root}"/>
        <parameter name="files" value="*.*"/>
      </parameters>
    </task>

    <task name="create.install.root" typename="@CreateFile" critical="false">
      <dependencies list="delete.root.files,remove.readonly.attribute"/>
      <parameters>
        <parameter name="filename" value="${target.root}\install.root"/>
        <parameter name="text" value="Per Aspera Ad Astra"/>
        <parameter name="append" value="false"/>
        <parameter name="create.directory" value="false"/>
      </parameters>
    </task>

    <task name="refresh.desktop" typename="@RefreshDesktop">
      <description>
        Windows Vista does not always refresh it's desktop after changes.
      </description>
      <dependencies list="delete.root.files[requireSuccess=false]"/>
    </task>

  </tasks>
  
</taskrunner>
